package com.sanhe.a448.event;

import androidx.annotation.NonNull;

import com.menu.app.event.BaseEvent;

public class HspHourEvent extends BaseEvent<byte[]> {

    public HspHourEvent() {
        value = new byte[2];
        for (int i = 0; i < value.length; i++) {
            value[i] = 0;
        }
    }

    public void setValue(int index, byte v) {
        value[index] = v > 9 ? 0 : v;
        post();
    }

    @Override
    protected byte[] getDefault() {
        return new byte[2];
    }

    @NonNull
    @Override
    public String toString() {
        StringBuffer sb = new StringBuffer();
        for (byte b : value) {
            sb.append(b);
        }
        return sb.toString();
    }
}
